<#assign contextPath=springMacroRequestContext.getContextPath() />
<#import "/public/frame/main.html" as frame />
<@frame.head "南航明珠商城-换货管理">
</@frame.head>
<link rel="stylesheet" type="text/css" href="${contextPath}/resources/css/search_table.css" />
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 后台管理中心 <span class="c-gray en">&gt;</span>退货管理 <span class="c-gray en">&gt;</span>换货管理 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="page-container">
<form method="post" name="query_order_form"  id="query_order_form" action="${contextPath}/exchange/query_exchange_h_list" >    
   <input type="hidden" name="page" value="${pagination.pageNo}"  id="page" />                       
    <div class="text-c">
         <table class="table">
               
                <tr>
                      <input id="exchangeType" value="2" class="input-text  radius" style="width:250px" placeholder="" name="exchangeType" type="hidden">
	            	<td style="text-align: right;">商品名称：</td>
                   <td>
                        <input id="prodName" value="${exchangeQo.prodName}" class="input-text  radius" style="width:250px" placeholder="" name="prodName" type="text">
                    </td>
                     <td style="text-align: right ;">退换状态：</td>
                   <td>
                   <span class="select-box radius" style="width:250px">            
          	   
                       <select style="width:240px" class="select" name="exchangeStatus" id="exchangeStatus">
                        <#if excheMapStatus??>
					  	<#list excheMapStatus?keys as key>
					    <option <#if exchangeQo.exchangeStatus==key > selected="selected"</#if>  value="${key}">${excheMapStatus[key]}</option>
					 	</#list>
					 	</#if>	
						</select>
					</span>
					</td>
					<td style="text-align: right ;">申请时间：</td>
			         <td> 
			          	<input 	onfocus="WdatePicker({ maxDate:'#F{$dp.$D(\'endDate\')||\'%y-%M-%d\'}',readOnly: true })" 
			          			id="startDate" name="exchangeDateStartTime" value="<#if exchangeQo.exchangeDateStartTime?? >${exchangeQo.exchangeDateStartTime?date}</#if>" 
			           			class="input-text Wdate" style="width:45%;" readonly="" type="text">
			                                                至
			               <input onfocus="WdatePicker({ minDate:'#F{$dp.$D(\'startDate\')}',maxDate:'%y-%M-%d',readOnly: true })"
			               			id="endDate"   name="exchangeDateEndTime" value="<#if exchangeQo.exchangeDateEndTime?? >${exchangeQo.exchangeDateEndTime?date}</#if>" 
			               			class="input-text Wdate" style="width:45%;" type="text">
			         </td>
             </tr>
              <tr>
                 <!-- 	<td style="text-align: right;">退换属性：</td>
                   <td>
                   <span class="select-box radius" style="width:250px">            
          	
                       <select class="select" name="exchangeType" id="exchangeType" style="width:240px">
                       <#if excheMapType??>
					    <#list excheMapType?keys as key>
					     <option  <#if exchangeQo.exchangeType==key > selected="selected"</#if> value="${key}">${excheMapType[key]}</option>
					 	</#list>
						</#if>	
						</select>
					</span>
                    </td> -->
                  
                    </td>
                    
                </tr>
                 <tr>
                 	<td colspan="6" style="text-align: center;">
                 	 <button type="button" class="btn btn-success" onclick="search()" id="" name=""><i class="Hui-iconfont">&#xe665;</i> 查询</button>
           			 <button type="button" class="btn btn-success"   onclick="toEmpty()" ><i class="Hui-iconfont">&#xe665;</i> 重置</button>
                	 </td>
              </tr>
              
            </table>
           
    </div>
</form>

    <div class="cl pd-5 bg-1 bk-gray mt-20"> 
  
    
    <span class="r">共有数据：<strong> ${pagination.totalCount} </strong> 条</span> </div>
    <table class="table table-border table-bordered table-bg">
        <thead>
        <tr   class="text-c">
          
		<!-- 	<th>退换货单号</th> -->
			<th>订单编号</th>
			<th>申请人	</th>
			<th>商品名称</th>
			<th>申请退换时间</th>
			<th>申请退换属性</th>
			<th>申请退换状态</th>
			<th>操作</th>

	 
        </tr>
        </thead>
        <tbody>
       <#if pagination.list?? && (pagination.list?size &gt; 0) >
        <#list pagination.list as exlist> 
        	 <tr  class="text-c">
        	<!--  <td>${exlist.id} </td> -->
        	  <td>${exlist.order.id} </td>
        	  <td>${exlist.exchanger} </td>
        	  <td>${exlist.prodName} </td>
        	  <td><#if exlist.exchangeDate??>
        	  		 ${exlist.exchangeDate?datetime}
        	  		</#if>
        	  
        	   </td>
        	  <td>
        	  	<#if excheMapType[exlist.exchangeType]??>
        	  		 ${excheMapType[exlist.exchangeType]}
        	  	</#if>
        	  </td>
        	  <td>
        	
        	  	<#if excheMapStatus[''+exlist.exchangeStatus+'']??>
        	  		 ${excheMapStatus[''+exlist.exchangeStatus+'']}
        	  	</#if>
        	   </td>
        	  <td>
        	 	
        	  	<a title="详情" href="javascript:;" onclick="dio_result(${exlist.order.id},${exlist.id})" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont"></i></a>
				<#if exlist.exchangeStatus==11 || exlist.exchangeStatus== 1>
					<a href="#" onclick="audit_result(${exlist.order.id},${exlist.id})">审核</a>
					<a href="#" onclick="deleAudit('${exlist.id}')">删除</a>
				</#if>		
        	   </td>
        	 
        	 </tr>
      </#list>
  
      </#if>
     </tbody>
    </table>
    <div id="biuuu_city" style="padding-top: 10px;float: right"></div>
</div>


<script type="text/javascript" src="${contextPath}/resources/lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="${contextPath}/resources/js/laypage/laypage.js"></script>

<script type="text/javascript">
var path="${contextPath}";

/* --------------分页加载---------------*/
laypage({
    cont: 'biuuu_city',//容器。值支持id名、原生dom对象，jquery对象。
    pages: ${pagination.totalPage},//通过后台拿到的总页数
    curr:  ${pagination.pageNo} || 1, //当前页
    skip: true, //是否开启跳页
	first: 1, //将首页显示为数字1,。若不显示，设置false即可
	last: ${pagination.totalPage}, //将尾页显示为总页数。若不显示，设置false即可
    jump: function(obj , first){//触发分页后的回调
        if(!first){ //点击跳页触发函数;当前页为obj.curr
          $(page).val(obj.curr);//获取点击的页码
          $(query_order_form).submit();
        }
    }
});

/* --------------查看详情 ---------------*/
 function dio_result(no,id){
 
	   var index = layer.open({
		    type: 2,
		    title: '查看详情',
		    maxmin: true,
		    scrollbar: false,
		    content: path+"/exchange/query_exchange_detil?id="+id+"&orderNo="+no,
		    area: ['860px', '680px']
		    });
	 
 }
/* --------------审核 ---------------*/
function audit_result(no,id){

	   var index = layer.open({
		    type: 2,
		    title: '审核',
		    maxmin: true,
		    scrollbar: false,
		    content: path+"/exchange/to_Audit_exchange?id="+id+"&orderNo="+no,
		    area: ['860px', '680px']
		    });
	 
}
 
//删除
function deleAudit(exchangeId) {
	if (confirm("确定要删除该记录？")) {
		var url = path + "/exchange/delete_exchange";
		$.ajax({
			url: url,
			type: "post",
			dataType: "text",
			data: {"id": exchangeId},
			success: function(msg) {
				if (msg == 0) {
					layer.msg('删除成功!', {icon: 1, time: 1000}, function(){window.location.href = window.location.href;});
				} else if (msg == 1){
					layer.msg('删除失败!', {icon: 1, time: 1000}, function(){});
				} else {
		   			  layer.alert(msg);
				}
			},
			error : function() {
				layer.alert("失败");
			}
		});
	}
}
</script>
<script type="text/javascript" src="${contextPath}/resources/js/exchange/exchange_h_list.js"></script>
</body>
<@frame.end "default">
</@frame.end>

 
